package io;

import java.io.IOException;
import java.io.RandomAccessFile;

//利用RandomAccessFile实现在txt文件后写
public class AppendContene {
    public static void main(String[] args) throws IOException {
        RandomAccessFile randomAccessFile = new RandomAccessFile("out.txt","rw");
        //将文件记录指针移动到out.txt文件的最后
        randomAccessFile.seek(randomAccessFile.length());
        randomAccessFile.write("\n跟屁虫\n".getBytes());
        randomAccessFile.close();
    }
}
